package com.bussiness.system.service;

import java.util.Map;

import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.List;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.plugins.pagination.PageHelper;

import java.util.HashMap;
import com.bussiness.system.dao.OssDao;
import com.bussiness.system.entity.OssEntity;
import com.bussiness.system.dto.OssEntityDto;
import com.bussiness.system.query.OssEntityQuery;
import com.bussiness.system.face.OssService;
import com.bussiness.system.util.Result;

@Service("ossService")
public class OssServiceImpl extends ServiceImpl<OssDao, OssEntity> implements OssService {

    @Autowired
    OssDao ossDao;

    @Override
    public Result queryPage(OssEntityQuery query) {

        PageHelper.startPage(query.getPageNum(), query.getPageSize());

        List<OssEntityDto> list = ossDao.selectByQuery(query);

        int total = (int) PageHelper.freeTotal();

        Map<String,Object> map = new HashMap<>();
        map.put("ossEntityList",list);
        map.put("total",total);
        return new Result<Map>().success(map);
    }


    /**
    *   mybatis plus wapper 演示 demo
    * @param query
    * @return
    */
    @Override
    public Result queryWrapperPage(OssEntityQuery query){
        return null;
    }

}
